<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true" />

            <br/>
            <h3 class="title">Boletim de Cadastro Imobiliário</h3>

            <h:form id="realtyForm" enctype="multipart/form-data">
                <p:growl id="messages" showDetail="true" autoUpdate="true"  />
                <p:tabView id="tabView">
                    <p:tab id="tabf" title="Inscrição">

                        <h4 class="title">Inscrição Cadastral</h4>
                        <p:panel id="realtyPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix ">

                            <p:outputLabel value="Inscrição Imóvel:" styleClass="grid_4" for="maskinscricao" />
                            <p:inputMask mask="?99.99.999.9999.99" id="maskinscricao" 
                                         styleClass="grid_6"  value="#{managerCriarImovel.visaoInscricao}"/>
                            <p:watermark value="DD.SS.QUADR.LOTE.UN" for="maskinscricao" />

                            <p:outputLabel value="Fator Localização:" styleClass="grid_4" for="fInputText" />
                            <p:inputText id="fInputText" styleClass="grid_6" 
                                         value="#{managerCriarImovel.imovel.fatorLocalizacao}" />

                        </p:panel>
                        <h4 class="title">Proprietário</h4>
                        <p:panel id="proprietarioPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix ">
                            <p:outputLabel id="personOutputLabel" value="Pessoa:" 
                                           for="personRadioButton" styleClass="grid_3" style="top: 6px" />
                            <div class="grid_8">
                                <p:selectOneRadio id="personRadioButton" style="height: 40px; margin-bottom: 0px;"
                                                  value="#{managerCriarImovel.proprietario.tipoDocumento}" >
                                    <f:selectItems value="#{managerCriarImovel.tipoDocumentoList()}" />
                                    <p:ajax event="change" update="proprietarioPanel" />
                                </p:selectOneRadio>
                            </div>

                            <div class="clear-both" />
                            <p:outputLabel styleClass="grid_3" for="cpfCnpjInputMask"
                                           value="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF' ? 'CPF:' : 'CNPJ:'}" />
                            <p:inputMask id="cpfCnpjInputMask" styleClass="grid_6"
                                         mask="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF' ? '999.999.999-99' : '99.999.999/9999-99'}"
                                         value="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF' ? 
                                                  managerCriarImovel.proprietario.cpf : managerCriarImovel.proprietario.cnpj}" >
                                <p:ajax event="blur" update="proprietarioPanel" 
                                        listener="#{managerCriarImovel.existProprietario()}" />
                            </p:inputMask>
                            <div class="clear-both" />

                            <p:outputLabel styleClass="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF' ? 'grid_3': 'grid_3 companyLabelImovel'}" 
                                           for="nomeInputText"
                                           value="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF' ? 'Nome:' : 'Nome Fantasia:'}">
                                <span style="float: right; margin-left: 0.2em !important; margin-right: -12px; color: red;">*</span>
                            </p:outputLabel>
                            <p:inputText id="nomeInputText" styleClass="grid_19" 
                                         value="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF' ? 
                                                  managerCriarImovel.proprietario.nome : managerCriarImovel.proprietario.nomeFantasia}" />

                            <p:outputLabel value="Data Nasc.:" styleClass="grid_3 dataNascLabel" for="dataNascCalendar" 
                                           rendered="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF'}" />
                            <p:calendar id="dataNascCalendar" styleClass="grid_5"
                                        showOn="both" locale="pt" yearRange="1900:2020" 
                                        navigator="true" pattern="dd/MM/yyyy"
                                        value="#{managerCriarImovel.proprietario.dataNasc}"
                                        rendered="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF'}" />

                            <p:outputLabel styleClass="grid_3 alpha" for="rgInputText"
                                           value="RG:" rendered="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF'}" />
                            <p:inputText id="rgInputText" styleClass="grid_4" rendered="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF'}"
                                         value="#{managerCriarImovel.proprietario.rg}" />

                            <p:outputLabel styleClass="grid_3" for="orgEmissorInputText"
                                           value="Org. Emissor:" rendered="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF'}" />
                            <p:inputText id="orgEmissorInputText" styleClass="grid_4" 
                                         rendered="#{managerCriarImovel.proprietario.tipoDocumento eq 'CPF'}"
                                         value="#{managerCriarImovel.proprietario.orgaoEmissor}" />


                            <div class="clear-both" /><br />

                            <div class="buttonAction">
                                <p:commandButton value="Adicionar"
                                                 process="proprietarioPanel"
                                                 actionListener="#{managerCriarImovel.addProprietario()}"
                                                 update="proprietarioPanel, tableProprietario"
                                                 id="addOnwerCommandButton" icon="ui-icon-plus"/>
                            </div>
                            <br />

                            <p:dataTable id="tableProprietario" var="item" value="#{managerCriarImovel.imovel.proprietarios}" 
                                         styleClass="grid_24" emptyMessage="Nenhum registro">  
                                <f:facet name="header">
                                    Nome do Proprietário ou Detentor
                                </f:facet>

                                <p:column headerText="Ação" width="50" style="text-align: center">
                                    <p:commandButton  styleClass="optionButton" alt="Editar" 
                                                      update=":realtyForm:tabView:proprietarioPanel, tableProprietario"
                                                      process="@this" icon="ui-icon-pencil" rendered="#{item.id eq null}"
                                                      actionListener="#{managerCriarImovel.editProprietario(item)}" />
                                    <p:commandButton  styleClass="optionButton" alt="Remover"
                                                      update=":realtyForm:tabView:proprietarioPanel, tableProprietario"
                                                      process="@this" icon="ui-icon-trash"
                                                      actionListener="#{managerCriarImovel.removerProprietario(item)}" />
                                </p:column>

                                <p:column headerText="Nome">  
                                    #{item.tipoDocumento eq 'CPF' ? item.nome : item.nomeFantasia}
                                </p:column>

                                <p:column headerText="Documento" width="60">  
                                    #{item.tipoDocumento eq 'CPF' ? item.cpf : item.cnpj}
                                </p:column> 

                            </p:dataTable>

                        </p:panel>
                        <br/>
                        <h4 class="title">Localização Imóvel</h4>
                        <p:panel id="localPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix ">

                            <p:outputLabel value="CEP:" styleClass="grid_3" for="cepInputMask" />
                            <p:inputMask id="cepInputMask" styleClass="grid_4" mask="99.999-999" autocomplete="false" 
                                         value="#{managerCriarImovel.imovel.enderecoImovel.cep}" >
                                <p:ajax event="blur" update=":realtyForm:tabView:localPanel"
                                        listener="#{managerCriarImovel.existeEnderecoImovel()}" />
                            </p:inputMask>
                            
                            <p:outputLabel value="Usar este endereço para correspondência" for="enderecoSelectBooleanCheckbox" />
                            <p:selectBooleanCheckbox id="enderecoSelectBooleanCheckbox" styleClass="grid_1"
                                                     value="#{managerCriarImovel.usarMesmoEndereco}" >
                                <p:ajax event="change" update=":realtyForm:tabView:endCorrespondenciaPanel"
                                        listener="#{managerCriarImovel.usarEnderecoParaCorrespondencia()}" />
                            </p:selectBooleanCheckbox>
                            
                            <div class="clear-both" />

                            <p:outputLabel value="Logradouro:" styleClass="grid_3" for="patioInputText" />
                            <p:inputText id="patioInputText" styleClass="grid_19" 
                                         readonly="#{managerCriarImovel.disableEnderecoImovel}"
                                         value="#{managerCriarImovel.imovel.enderecoImovel.nomeclog}" />

                            <p:outputLabel value="Bairro:" styleClass="grid_3" for="neighborhoodInputText" />
                            <p:inputText id="neighborhoodInputText" styleClass="grid_19"
                                         readonly="#{managerCriarImovel.disableEnderecoImovel}"
                                         value="#{managerCriarImovel.imovel.enderecoImovel.bairro}" />

                            <p:outputLabel value="Número:" styleClass="grid_3" for="numInputText" />
                            <p:inputText id="numInputText" styleClass="grid_4"
                                         value="#{managerCriarImovel.imovel.enderecoImovel.numero}" />

                            <p:outputLabel value="Complemento:" styleClass="grid_3 alpha" for="compInputText" />
                            <p:inputText id="compInputText" styleClass="grid_12"
                                         value="#{managerCriarImovel.imovel.enderecoImovel.compl}" />

                        </p:panel>

                        <h4 class="title">Endereço Correspondência</h4>
                        <p:panel id="endCorrespondenciaPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix ">

                            <p:outputLabel value="CEP:" styleClass="grid_3" for="endcepInputMask" />
                            <p:inputMask id="endcepInputMask" styleClass="grid_4" mask="99.999-999" autocomplete="false"
                                         readonly="#{managerCriarImovel.disabilitarEnderecoCorrespondencia()}"
                                         value="#{managerCriarImovel.imovel.enderecoCorrespondencia.cep}" >
                                <p:ajax event="blur" update=":realtyForm:tabView:endCorrespondenciaPanel"  
                                        listener="#{managerCriarImovel.existeEnderecoCorrespondencia()}" />
                            </p:inputMask>
                            <div class="clear-both" />

                            <p:outputLabel value="Logradouro:" styleClass="grid_3" for="endpatioInputText" />
                            <p:inputText id="endpatioInputText" styleClass="grid_19"
                                         readonly="#{managerCriarImovel.disabilitarEnderecoCorrespondencia()}"
                                         value="#{managerCriarImovel.imovel.enderecoCorrespondencia.nomeclog}" />

                            <p:outputLabel value="Bairro:" styleClass="grid_3" for="endneighborhoodInputText" />
                            <p:inputText id="endneighborhoodInputText" styleClass="grid_19"
                                         readonly="#{managerCriarImovel.disabilitarEnderecoCorrespondencia()}"
                                         value="#{managerCriarImovel.imovel.enderecoCorrespondencia.bairro}" />

                            <p:outputLabel value="Número:" styleClass="grid_3" for="endnumInputText" />
                            <p:inputText id="endnumInputText" styleClass="grid_4" 
                                         readonly="#{managerCriarImovel.disabilitarEnderecoCorrespondencia() and managerCriarImovel.usarMesmoEndereco}"
                                         value="#{managerCriarImovel.imovel.enderecoCorrespondencia.numero}" />

                            <p:outputLabel value="Complemento:" styleClass="grid_3 alpha" for="endcompInputText" />
                            <p:inputText id="endcompInputText" styleClass="grid_12"
                                         readonly="#{managerCriarImovel.disabilitarEnderecoCorrespondencia() and managerCriarImovel.usarMesmoEndereco}"
                                         value="#{managerCriarImovel.imovel.enderecoCorrespondencia.compl}" />

                        </p:panel>

                        <br/>
                        <h4 class="title">Georreferenciamento</h4>
                        <p:panel id="geoPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix ">
                            <center>
                                <p:gmap center="-2.9136, -41.7577" zoom="10" type="HYBRID"   
                                        style="width:910px;height:500px" model="#{managerCriarImovel.mapModel}" />   
                            </center>

                            <br/> 
                            <h5 class="title">Inserir dados</h5>
                            <br/>
                            <p:outputLabel value="Ponto " styleClass="grid_3" for="pontoText" />
                            <p:inputText id="pontoText" styleClass="grid_19"
                                         value="#{managerCriarImovel.coordenada.ponto}" />
                            <div class="clear"/>
                            <p:outputLabel value="N " styleClass="grid_3" for="norteText" />
                            <p:inputText id="norteText" styleClass="grid_8"
                                         value="#{managerCriarImovel.coordenada.convN}" />
                            <p:outputLabel value="E " styleClass="grid_3" for="lesteText" style="margin-left: 2px" />
                            <p:inputText id="lesteText" styleClass="grid_8"
                                         value="#{managerCriarImovel.coordenada.convE}" />
                            <div class="clear"/>
                            <p:outputLabel value="Azimute" styleClass="grid_3" for="azimuteText" />
                            <p:inputText id="azimuteText" styleClass="grid_8"
                                         value="#{managerCriarImovel.coordenada.azimute}" />
                            <p:outputLabel value="Distância " styleClass="grid_3" for="disText" />
                            <p:inputText id="disText" styleClass="grid_8" style="left: -0.9%"
                                         value="#{managerCriarImovel.coordenada.distancia}" />

                            <p:outputLabel value="Limite " styleClass="grid_3" for="limText" />
                            <p:inputTextarea id="limText"  styleClass="grid_19"
                                             value="#{managerCriarImovel.coordenada.limite}" />
                            <br/>
                            <br/>
                            <div class="buttonAction">
                                <p:commandButton id="bt_add" value="Adicionar" icon="ui-icon-plus"
                                                 update="tableGeo, :realtyForm:tabView:geoPanel"
                                                 actionListener="#{managerCriarImovel.add()}"
                                                 styleClass="ui-priority-primary" />
                                <p:commandButton id="bt_clear" value="Limpar" icon="ui-icon-close"
                                                 update="@form" />
                            </div >

                            <p:blockUI id="BLOCK" block="tableGeo" trigger="bt_add" > 
                                <p:graphicImage value="media/images/ajax-loader.gif"/>
                            </p:blockUI> 

                            <h5 class="title">Coordenadas</h5>
                            <br/>
                            <p:dataTable id="tableGeo" var="item" value="#{managerCriarImovel.coordenadas}" 
                                         styleClass="grid_24" rowIndexVar="rowid"
                                         rowKey="#{item.id}" rows="5" paginator="true"  
                                         paginatorPosition="bottom" emptyMessage="Nenhum registro">  
                                <f:facet name="header">
                                    Imóvel
                                </f:facet>
                                <p:column headerText="Ação" width="60">
                                    <p:commandButton title="Editar"
                                                     icon="ui-icon-pencil"
                                                     update=":realtyForm:tabView:geoPanel"
                                                     actionListener="#{managerCriarImovel.editarCoordenada(item)}"/>
                                    <p:commandButton title="Visualizar"
                                                     oncomplete="dlgVisu.show();"
                                                     update=":dlgVisuForm:paneldlg"
                                                     actionListener="#{managerCriarImovel.visualizarCoordenada(item)}"
                                                     icon="ui-icon-zoomin"/>
                                    <p:commandButton update="@form" title="Excluir"
                                                     actionListener="#{managerCriarImovel.delete(item)}"
                                                     icon="ui-icon-trash" />
                                </p:column>

                                <p:column headerText="Ponto" width="150">  

                                    <h:outputText value="#{item.ponto}"/>

                                </p:column>
                                <p:column headerText="N UTM" width="150">  

                                    <h:outputText value="#{item.convN}"/>

                                </p:column>
                                <p:column headerText="E UTM" width="100">  

                                    <h:outputText value="#{item.convE}"/>

                                </p:column> 

                            </p:dataTable> 

                        </p:panel>

                    </p:tab>

                    <p:tab id="tab1" title="Patrimônio">

                        <br/>
                        <h4 class="title">Informações Sobre o Imóvel</h4>
                        <br/>

                        <div class="clear"/>
                        <h5 class="title">Patrimônio</h5>
                        <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.patrimonio}">
                            <f:selectItems value="#{managerCriarImovel.patrimonioList}"  />
                            <p:ajax event="change" update=":realtyForm:tabView:patrimonioUniaoPanelGrid" 
                                    listener="#{managerCriarImovel.eventChangePatrimonioUniao()}" />
                        </p:selectOneRadio>
                        <br/>
                        <div class="clear-both"/>
                        <h:panelGrid id="patrimonioUniaoPanelGrid" styleClass="#{managerCriarImovel.imovel.patrimonio ne 'UNIAO' ? 'invisible' : 'panelGrid'}">
                            <h5 class="title">Rip</h5>
                            <h:panelGrid columns="2" style="background: none; border: none;" styleClass="container_24 clearfix panelGrid">
                                <p:outputLabel value="Número:" for="codRip" />
                                <p:inputText id="codRip" styleClass="grid_24" value="#{managerCriarImovel.imovel.rip}" />
                            </h:panelGrid>

                            <h5 class="title">Rip: é em nome do proprietário atual ?</h5>
                            <div class="clear"/>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" 
                                              value="#{managerCriarImovel.imovel.ripNomeCadastrado}" 
                                              >
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>

                            <h5 class="title">O proprietário é falecido ?</h5>
                            <div class="clear"/>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" 
                                              value="#{managerCriarImovel.imovel.titularFalecido}" 
                                              >
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>

                            <h5 class="title">Qual o vínculo do atual proprietário com o cadastro na SPU ?</h5>
                            <div class="clear"/>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" 
                                              value="#{managerCriarImovel.imovel.vinculoTitularRip}" 
                                              >
                                <f:selectItems value="#{managerCriarImovel.vinculoTitularRip}"/>
                            </p:selectOneRadio>
                        </h:panelGrid>

                        <br/>
                        <h5 class="title">Tipo de Documento</h5>

                        <p:selectOneRadio styleClass="grid_3"  layout="pageDirection" value="#{managerCriarImovel.imovel.tipoDocumentoImovel}">
                            <f:selectItems value="#{managerCriarImovel.tipoDocumentoImovel}"/>
                        </p:selectOneRadio>
                        <div class="clear"/>
                        <br/>
                        
                        <h5 class="title">Número do Registro</h5>
                        <p:inputText value="#{managerCriarImovel.imovel.numeroReg}" styleClass="grid_8" style="left: 20px" />
                        <div class="clear"/>
                        <br/>

                        <h5 class="title">Tempo de Moradia na Residência</h5>
                        <h:panelGrid columns="2" style="background: none; border: none;" styleClass="container_24 clearfix">
                            <p:outputLabel value="Anos:" for="codTempo" />
                            <p:inputText id="codTempo" styleClass="grid_12" 
                                         value="#{managerCriarImovel.imovel.tempoMoradia}" />
                        </h:panelGrid>

                        <h5 class="title">Tempo de Moradia no Município</h5>
                        <h:panelGrid columns="2" style="background: none; border: none;" styleClass="container_24 clearfix">
                            <p:outputLabel value="Anos:" for="tempoMoradiaMunicipio" />
                            <p:inputText id="tempoMoradiaMunicipio" styleClass="grid_12" 
                                         value="#{managerCriarImovel.imovel.tempoMoradiaMunicipio}" />
                        </h:panelGrid>

                        <div class="clear"/>

                        <h5 class="title">Composição Familiar</h5>
                        <p:selectOneRadio styleClass="grid_3" layout="" value="#{managerCriarImovel.imovel.composicaoFamiliar}">
                            <f:selectItems value="#{managerCriarImovel.composicaoFamiliar}"/>
                            <p:ajax event="change" listener="#{managerCriarImovel.verificaComposicaoFamiliar()}"
                                    update=":realtyForm:tabView:moradoresPanel" />
                        </p:selectOneRadio>
                        <div class="clear" />

                        <p:panel id="moradoresPanel" styleClass="withoutBorder container_24 clearfix" >
                            <h5 class="title"> Moradores </h5>
                            <p:outputLabel styleClass="grid_3" value="Nome:" for="nomeMoradorInputText">
                                <span class="ui-outputlabel-rfi">*</span>
                            </p:outputLabel>
                            <p:inputText id="nomeMoradorInputText" value="#{managerCriarImovel.morador.nome}" 
                                         styleClass="grid_20" 
                                         disabled="#{managerCriarImovel.disableInputsMorador}" />

                            <p:outputLabel value="Data Nasc.:" styleClass="grid_3 dataNascLabel" 
                                           for="dataNascMoradorCalendar" />
                            <p:calendar id="dataNascMoradorCalendar" styleClass="grid_4" 
                                        showOn="both" locale="pt" yearRange="1900:2020" 
                                        navigator="true" pattern="dd/MM/yyyy"
                                        disabled="#{managerCriarImovel.disableInputsMorador}"
                                        value="#{managerCriarImovel.morador.dataNasc}" />

                            <p:outputLabel styleClass="grid_3" value="Profissão:" for="profissaoMoradorInputText" />
                            <p:inputText id="profissaoMoradorInputText" value="#{managerCriarImovel.morador.profissao}" 
                                         styleClass="grid_13" disabled="#{managerCriarImovel.disableInputsMorador}"/>

                            <p:outputLabel styleClass="grid_3" value="Parentesco:" for="parentescoMoradorInputText" />
                            <div class="grid_6">
                                <p:selectOneMenu id="parentescoMoradorInputText" panelStyle="width:150px;" 
                                                 disabled="#{managerCriarImovel.disableInputsMorador}"
                                                 value="#{managerCriarImovel.morador.grauParentesco}">  
                                    <f:selectItem itemLabel="" itemValue="" />
                                    <f:selectItems value="#{managerCriarImovel.parentesco}"/>  
                                </p:selectOneMenu> 
                            </div>

                            <p:outputLabel styleClass="grid_2" value="CPF:" for="cpfMoradorInputText" />
                            <p:inputMask id="cpfMoradorInputText" value="#{managerCriarImovel.morador.cpf}" 
                                         mask="999.999.999-99" styleClass="grid_5" disabled="#{managerCriarImovel.disableInputsMorador}"/>

                            <p:outputLabel styleClass="grid_2 alpha" value="RG:" for="rgMoradorInputText" />
                            <p:inputText id="rgMoradorInputText" value="#{managerCriarImovel.morador.rg}" 
                                         styleClass="grid_5" disabled="#{managerCriarImovel.disableInputsMorador}"/>
                            <div class="clear" /> <br />

                            <div class="buttonAction">
                                <p:commandButton value="Adicionar" 
                                                 disabled="#{managerCriarImovel.disableInputsMorador}"
                                                 actionListener="#{managerCriarImovel.addMorador()}"
                                                 update=":realtyForm:tabView:moradoresPanel"
                                                 process=":realtyForm:tabView:moradoresPanel"
                                                 id="addMoradorCommandButton"
                                                 icon="ui-icon-plus"/>
                                <p:commandButton value="Limpar" icon="ui-icon-close" 
                                                 disabled="#{managerCriarImovel.disableInputsMorador}"
                                                 update="moradoresPanel" process="@this" >
                                    <p:resetInput target=":realtyForm:tabView:nomeMoradorInputText, :realtyForm:tabView:parentescoMoradorInputText, 
                                                  :realtyForm:tabView:cpfMoradorInputText, :realtyForm:tabView:rgMoradorInputText,
                                                  :realtyForm:tabView:profissaoMoradorInputText, :realtyForm:tabView:dataNascMoradorCalendar" />
                                </p:commandButton>
                            </div>
                            <br />

                            <p:dataTable id="compFamiliarDataTable" var="item" value="#{managerCriarImovel.imovel.moradores}" 
                                         styleClass="grid_24" rowIndexVar="rowid" rowKey="#{item.id}" rows="5"
                                         paginator="true" paginatorPosition="bottom" emptyMessage="Nenhum registro">  
                                <f:facet name="header"> Composição Familiar </f:facet>

                                <p:column headerText="Ação" width="40">
                                    <p:commandButton  style="width: 20px; height: 20px;" 
                                                      title="Editar"
                                                      update=":realtyForm:tabView:moradoresPanel"
                                                      actionListener="#{managerCriarImovel.editarMorador(rowid, item)}"
                                                      icon="ui-icon-pencil"/>
                                    <p:commandButton  style="width: 20px; height: 20px;" 
                                                      title="Remover"
                                                      update=":realtyForm:tabView:moradoresPanel"
                                                      actionListener="#{managerCriarImovel.removerMorador(rowid)}"
                                                      icon="ui-icon-trash"/>
                                </p:column>

                                <p:column headerText="Nome" width="150">  
                                    <h:outputText value="#{item.nome}"/>
                                </p:column>

                                <p:column headerText="Parentesco" width="150">  
                                    <h:outputText value="#{item.grauParentesco.nome}"/>
                                </p:column>

                                <p:column headerText="CPF" width="100">  
                                    <h:outputText value="#{item.cpf}"/>
                                </p:column> 

                                <p:column headerText="RG" width="100">  
                                    <h:outputText value="#{item.rg}"/>
                                </p:column> 
                            </p:dataTable>
                        </p:panel>

                        <br/>
                        <div class="clear"/>
                        <h5 class="title">Renda Familiar</h5>
                        <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.rendaFamiliar}">
                            <f:selectItems value="#{managerCriarImovel.rendaFamiliar}"/>
                        </p:selectOneRadio>
                        <br/>
<!--                        <div class="clear"/>
                        <h5 class="title">Paga IPTU?</h5>
                        <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.pagaIptu}">
                            <f:selectItem itemLabel="Sim" itemValue="true" /> 
                            <f:selectItem itemLabel="Não" itemValue="false" />
                        </p:selectOneRadio>-->
                        <div class="clear"/>
                        <h5 class="title">Minha casa minha vida?</h5>
                        <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.minhaCasaMinhaVida}">
                            <f:selectItem itemLabel="Sim" itemValue="true" /> 
                            <f:selectItem itemLabel="Não" itemValue="false" />
                        </p:selectOneRadio>
                        <div class="clear"/>
                        <h5 class="title">Recebe bolsa família?</h5>
                        <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.bolsaFamilia}">
                            <f:selectItem itemLabel="Sim" itemValue="true" /> 
                            <f:selectItem itemLabel="Não" itemValue="false" />
                            <p:ajax event="change" update=":realtyForm:tabView:bolsaFamiliaPanelGrid" />
                        </p:selectOneRadio>

                        <p:panel id="bolsaFamiliaPanelGrid" styleClass="panelGrid withoutBorder" 
                                 style="#{managerCriarImovel.imovel.bolsaFamilia eq false or managerCriarImovel.imovel.bolsaFamilia eq null ? 'display: none' : ''}">
                            <p:outputLabel styleClass="grid_3" value="Valor:" for="valorBolsaFamilia" style="margin-left: 25px; top: 2px" />
                            <p:inputText id="valorBolsaFamilia" styleClass="grid_4" value="#{managerCriarImovel.valorBolsaFamilia}" 
                                         onkeypress="jQuery(this).autoNumeric({aSign:'R$ ', aSep: '.', aDec: ','} );" >
                            </p:inputText>
                        </p:panel>

                        <div class="clear"/>
                        <h5 class="title">Possui registro de Imóvel?</h5>
                        <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.regImovel}">
                            <f:selectItem itemLabel="Sim" itemValue="true" /> 
                            <f:selectItem itemLabel="Não" itemValue="false" />
                        </p:selectOneRadio>
                        <div class="clear"/>
                    </p:tab>

                    <p:tab id="tab2" title="Dados Gerais">

                        <h4 class="title">Dados Gerais</h4>

                        <p:panel id="infGeralPanel" style="background: none; border: none;" > 
                            <h5 class="title">Tipo do Terreno</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.typeRealty}">
                                <f:selectItems value="#{managerCriarImovel.typeRealty}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Tipo de Ocupação</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection"  value="#{managerCriarImovel.imovel.ocupacao}">
                                <f:selectItems value="#{managerCriarImovel.ocupacao}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Topografia do Terreno</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.topografia}">
                                <f:selectItems value="#{managerCriarImovel.topografia}"/>
                            </p:selectOneRadio>
                            
                            <div class="clear"/>
                            <h5 class="title">Situação do Terreno</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.situacaoTerreno}">
                                <f:selectItems value="#{managerCriarImovel.situacaoTerreno}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Tipo de Pedologia</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.pedologia}">
                                <f:selectItems value="#{managerCriarImovel.pedologia}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Utilização do Terreno</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.utilizacao}">
                                <f:selectItems value="#{managerCriarImovel.utilizacao}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Isento IPTU</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.insetoIptu}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Isento TSU</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.insetoTsu}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Uso do Imóvel</h5>    
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.usoImovel}">
                                <f:selectItems value="#{managerCriarImovel.usoImovel}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Observação</h5>    
                            <p:inputTextarea value="#{managerCriarImovel.imovel.obs}"/>

                        </p:panel>
                        <div class="clear"/>

                    </p:tab>

                    <p:tab id="tab3" title="Edificação">

                        <h4 class="title">Informações Sobre a Edificação</h4>

                        <p:panel id="infEdificacaoPanel" style="background: none; border: none;" 
                                 > 
                            <h5 class="title">Caracterização do Imóvel</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.caracterizacao}">
                                <f:selectItems value="#{managerCriarImovel.caracterizacao}"/>
                            </p:selectOneRadio>
                            <div class="clear"/>
                            
                            <h5 class="title">Tipo de Revestimento Externo</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.revExterno}">
                                <f:selectItems value="#{managerCriarImovel.revExterno}"/>
                            </p:selectOneRadio>
                            <div class="clear"/>
                            
                            <h5 class="title">Tipo de Piso</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.piso}">
                                <f:selectItems value="#{managerCriarImovel.piso}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Tipo de Forro</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.forro}">
                                <f:selectItems value="#{managerCriarImovel.forro}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Tipo de Cobertura</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.cobertura}">
                                <f:selectItems value="#{managerCriarImovel.cobertura}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Instalação Sanitária</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.instSanitaria}">
                                <f:selectItems value="#{managerCriarImovel.instSanitaria}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Posição do Imóvel</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.posicao}">
                                <f:selectItems value="#{managerCriarImovel.posicao}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Tipo de Construção</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.tipoConstrucao}">
                                <f:selectItems value="#{managerCriarImovel.tipoConstrucao}"/>
                            </p:selectOneRadio>


                            <div class="clear"/>
                            <h5 class="title">Estrutura do Imóvel</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.estrutura}">
                                <f:selectItems value="#{managerCriarImovel.estrutura}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Estado de Conservação do Imóvel</h5>
                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.estadoConservacao}">
                                <f:selectItems value="#{managerCriarImovel.estadoConservacao}"/>
                            </p:selectOneRadio>
                            <div class="clear"/>
                            <h5 class="title">Tipo de Instalações Elétrica</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.instalacoesEletricas}">
                                <f:selectItems value="#{managerCriarImovel.instalacoesEletrica}"/>
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Fachada</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.fachada}">
                                <f:selectItems value="#{managerCriarImovel.fachada}"/>
                            </p:selectOneRadio>

                        </p:panel>
                        <div class="clear"/>

                    </p:tab>
                    <p:tab id="tab4" title="Serviços">

                        <h4 class="title">Serviços Urbanos</h4>

                        <p:panel id="servPanel" style="background: none; border: none;" 
                                 > 

                            <h5 class="title">Calçamento</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.calcamento}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Iluminação Pública</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.iluminacaoPublica}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Limpeza Pública</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.limpezaPublica}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>

                            <div class="clear"/>
                            <h5 class="title">Coleta de Lixo</h5>

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerCriarImovel.imovel.coletaLixo}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>

                        </p:panel>
                        <div class="clear"/>

                    </p:tab>

                    <p:tab id="tab5" title="Dimensões">
                        <h4 class="title">Dimensões da Unidade</h4>

                        <p:panel id="dimenPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix"> 
                            <h5 class="title">Dimensões e Confrontações</h5>
                            <br/>
                            <h5 class="title">Frente</h5>
                            <p:outputLabel value="Para:" styleClass="grid_3" for="frenteInputText" />
                            <p:inputText id="frenteInputText" styleClass="grid_18"
                                         value="#{managerCriarImovel.imovel.frente}" />
                            <div class="clear"/>
                            <p:outputLabel value="Limitando:" styleClass="grid_3" for="frenteRuaInputText" />
                            <p:inputText id="frenteRuaInputText" styleClass="grid_18"
                                         value="#{managerCriarImovel.imovel.frenteRua}" />
                            <div class="clear"/>
                            <p:outputLabel value="Medindo:" styleClass="grid_3" for="frenteMedInputText" />
                            <p:inputText id="frenteMedInputText" styleClass="grid_18"
                                         value="#{managerCriarImovel.imovel.frenteMedindo}" />
                            <div class="clear"/>
                            <h5 class="title">Lado Direito</h5>

                            <p:outputLabel value="Para:" styleClass="grid_3" for="direitoParaInputText" />
                            <p:inputText id="direitoParaInputText" styleClass="grid_18" 
                                         value="#{managerCriarImovel.imovel.ladoDireito}" />
                            <div class="clear"/>

                            <p:outputLabel value="Limitando:" styleClass="grid_3" for="direitoRuaInputText" />
                            <p:inputText id="direitoRuaInputText" styleClass="grid_18" 
                                         value="#{managerCriarImovel.imovel.ladoDireitoRua}" />
                            <div class="clear"/>

                            <p:outputLabel value="Medindo:" styleClass="grid_3" for="direitoMedInputText" />
                            <p:inputText id="direitoMedInputText" styleClass="grid_18" 
                                         value="#{managerCriarImovel.imovel.ladoDireitoMedindo}" />
                            <div class="clear"/>
                            <h5 class="title">Lado Esquerdo</h5>
                            <p:outputLabel value="Para:" styleClass="grid_3" for="esquerdoInputText" />
                            <p:inputText id="esquerdoInputText" styleClass="grid_18" 
                                         value="#{managerCriarImovel.imovel.ladoEsquerdo}" />
                            <div class="clear"/>

                            <p:outputLabel value="Limitando:" styleClass="grid_3" for="esquerdoRuaInputText" />
                            <p:inputText id="esquerdoRuaInputText" styleClass="grid_18" 
                                         value="#{managerCriarImovel.imovel.ladoEsquerdoRua}" />
                            <div class="clear"/>

                            <p:outputLabel value="Medindo:" styleClass="grid_3" for="esquerdoMedInputText" />
                            <p:inputText id="esquerdoMedInputText" styleClass="grid_18" 
                                         value="#{managerCriarImovel.imovel.ladoEsquerdoMedindo}" />
                            <div class="clear"/>

                            <h5 class="title">Fundo</h5>


                            <p:outputLabel value="Para:" styleClass="grid_3" for="fundoInputText" />
                            <p:inputText id="fundoInputText" styleClass="grid_18" 
                                         value="#{managerCriarImovel.imovel.fundo}" />
                            <div class="clear"/>
                            <p:outputLabel value="Limitando:" styleClass="grid_3" for="fundoRuaInputText" />
                            <p:inputText id="fundoRuaInputText" styleClass="grid_18" 
                                         value="#{managerCriarImovel.imovel.fundoRua}" />
                            <div class="clear"/>
                            <p:outputLabel value="Medindo:" styleClass="grid_3" for="fundoMedInputText" />
                            <p:inputText id="fundoMedInputText" styleClass="grid_18" 
                                         value="#{managerCriarImovel.imovel.fundoMedindo}" />

                            <div class="clear"/>
                            <br/>

                            <h5 class="title">Dimensões Terreno</h5>
                            <br/>
                            <p:outputLabel value="Área Terreno:" styleClass="grid_3" for="areaInputText" />
                            <p:inputText id="areaInputText" styleClass="grid_4" 
                                         value="#{managerCriarImovel.imovel.dimensoes.areaTerreno}"
                                         onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                <f:convertNumber pattern="#,###,##0.00"/>
                            </p:inputText>

                            <!--                            <div class="clear"/>-->
                            <p:outputLabel value="Área Unidade:" styleClass="grid_3" for="areaUInputText" />
                            <p:inputText id="areaUInputText" styleClass="grid_4"
                                         value="#{managerCriarImovel.imovel.dimensoes.areaUnidade}"
                                         onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                <f:convertNumber pattern="#,###,##0.00"/>
                            </p:inputText>

                            <div class="clear"/>
                            <p:outputLabel value="Área Total:" styleClass="grid_3" for="areaTInputText" />
                            <p:inputText id="areaTInputText" styleClass="grid_4"
                                         value="#{managerCriarImovel.imovel.dimensoes.areaTotalEdificacao}"
                                         onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                <f:convertNumber pattern="#,###,##0.00"/>
                            </p:inputText>

                            <!--                            <div class="clear"/>-->
                            <p:outputLabel value="Perímetro:" styleClass="grid_3" for="perimetroInputText" />
                            <p:inputText id="perimetroInputText" styleClass="grid_4"
                                         value="#{managerCriarImovel.imovel.dimensoes.perimetro}"
                                         onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                <f:convertNumber pattern="#,###,##0.00"/>
                            </p:inputText>

                            <div class="clear"/>
                            <p:outputLabel value="N˚Pavimento:" styleClass="grid_3" for="areaPInputText" />
                            <p:inputText id="areaPInputText" styleClass="grid_2"
                                         value="#{managerCriarImovel.imovel.dimensoes.numPavimentacaoEdific}">
                            </p:inputText>
                            <div class="clear"/>
                            <br/>

                            <div class="clear"/>
                            <h5 class="title">Testada</h5>
                            <br/>
                            <p:outputLabel value="Testada do Imóvel:" style="width: 20%" styleClass="grid_3" for="areaTiInputText" />
                            <p:inputText id="areaTiInputText" styleClass="grid_4"
                                         value="#{managerCriarImovel.imovel.dimensoes.testadaImovel}"
                                         onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                <f:convertNumber pattern="#,###,##0.00"/>
                            </p:inputText>

                            <p:outputLabel value="Servida Conservação Calçamento:" style="width: 30%" styleClass="grid_3" for="areaTSInputText" />
                            <p:inputText id="areaTSInputText" styleClass="grid_4"
                                         value="#{managerCriarImovel.imovel.dimensoes.testadaServidaConservCalcamento}"
                                         onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                <f:convertNumber pattern="#,###,##0.00"/>
                            </p:inputText>

                            <div class="clear"/>
                            <p:outputLabel value="Servida Iluminação Pública:" style="width: 20%" styleClass="grid_3" for="areaTIInputText" />
                            <p:inputText id="areaTIInputText" styleClass="grid_4"
                                         value="#{managerCriarImovel.imovel.dimensoes.testadaServidaPorIluminacaoPublica}"
                                         onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                <f:convertNumber pattern="#,###,##0.00"/>
                            </p:inputText>

                            <p:outputLabel value="Servida Limpeza Pública:" style="width: 30%" styleClass="grid_3" for="areaTLInputText" />
                            <p:inputText id="areaTLInputText" styleClass="grid_4"
                                         value="#{managerCriarImovel.imovel.dimensoes.testadaServidaLimpezaPublica}"
                                         onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                <f:convertNumber pattern="#,###,##0.00"/>
                            </p:inputText>

                        </p:panel>

                    </p:tab>

                    <p:tab id="tab6" title="Documentos">
                        <h4 class="title">Documentos</h4>

                        <p:panel id="documentoPanel" style="background: none; border: none;" 
                                 styleClass="container_24 clearfix">
<!--                            <h5 class="title">Tipo de Documento</h5>

                            <p:selectOneRadio styleClass="grid_3"  layout="pageDirection" value="#{managerCriarImovel.imovel.tipoDocumentoImovel}">
                                <f:selectItems value="#{managerCriarImovel.tipoDocumentoImovel}"/>
                            </p:selectOneRadio>
                            <div class="clear"/>
                            <br/>-->
                            <h5 class="title">Anexos</h5>
                            <br/>
                            <p:fileUpload 
                                mode="advanced"
                                label="Anexar"
                                fileUploadListener="#{managerCriarImovel.handleAnnex}"
                                multiple="false"
                                auto="true"
                                invalidFileMessage="Tipo de arquivo não suportado."
                                invalidSizeMessage="Tamanho do arquivo não é suportado"
                                uploadLabel="Enviar"
                                cancelLabel="Cancelar"
                                immediate="true"
                                update=":realtyForm:tabView:documentoPanel"

                                />
                            <br/>
                            <br/>

                            <ui:repeat  value="#{managerCriarImovel.annexs}" var="a">
                                <p:panel styleClass="grid_4 withoutBorder" >
                                    <h:outputLink  
                                        value="#{a.type ne 'application/pdf' ? 'viewImage.xhtml':'show'}" title="#{a.description}"  target="_blank" >

                                        <div style="width: 100%;" class="grid_4">

                                            <p:graphicImage styleClass="image grid_3" rendered="#{a.type ne 'application/pdf'}"
                                                            style="margin-left:1%; width: 100px;"
                                                            url="show/?annex=#{a.id}" />

                                            <p:outputLabel  value="#{a.description.length() ge 10 ? a.description.substring(0, 10).concat('...') : 
                                                                     a.description.replace('.png','').replace(' ','_')}" 
                                                            style="margin-left:1%; width: 100px;" rendered="#{a.type ne 'application/pdf'}"/>

                                            <p:graphicImage styleClass="image grid_3" rendered="#{a.type eq 'application/pdf'}"
                                                            style="margin-left:1%; width: 100px;" 
                                                            url="assets/images/pdf.jpeg" />

                                            <p:outputLabel  value="#{a.description.length() ge 10 ? a.description.substring(0, 10).concat('...') : 
                                                                     a.description.replace('.pdf','').replace(' ','_')}" 
                                                            style="margin-left:1%; width: 100px;" rendered="#{a.type eq 'application/pdf'}"/>
                                        </div>
                                        <f:param name="annex" value="#{a.id}"/>
                                    </h:outputLink>

                                    <p:commandButton id="removeButton" alt="Remover" value="Remover"
                                                     icon="ui-icon-trash" update=":realtyForm:tabView:docPanel"
                                                     actionListener="#{managerCriarImovel.removeAnnex(a)}" />
                                </p:panel>
                            </ui:repeat>
                        </p:panel>

                    </p:tab> 

                </p:tabView>
                <div class="clear"/>

                <div class="buttonAction">
                    <p:commandButton value="Salvar" icon="ui-icon-disk"
                                     update="@form"
                                     action="#{managerCriarImovel.save()}"
                                     styleClass="ui-priority-primary" 
                                     />
                    <p:button href="pesquisarimovel.xhtml" value="Voltar"  icon="ui-icon-arrowreturnthick-1-w" />
                </div >

            </h:form>

            <h:form id="dlgVisuForm">
                <p:panel id="paneldlg" style="background: none; border: none;" 
                         styleClass="container_24 clearfix ">
                    <p:dialog id="iddlg" header="Visualizar Dados" widgetVar="dlgVisu" modal="false"
                              showEffect="fade" hideEffect="fade" width="600" resizable="false" height="20">  
                        <h:outputText value="Visualizar Dados Geográficos" /> <br/> 
                        <f:facet name="footer">

                            <p:outputLabel value="Ponto " styleClass="grid_3" for="pontoText" />
                            <p:inputText id="pontoText" styleClass="grid_19" readonly="true"
                                         value="#{managerCriarImovel.visuCoordenada.ponto}" />
                            <div class="clear"/>
                            <p:outputLabel value="N " styleClass="grid_3" for="norteText" />
                            <p:inputText id="norteText" styleClass="grid_8" readonly="true"
                                         value="#{managerCriarImovel.visuCoordenada.convN}" />
                            <p:outputLabel value="E " styleClass="grid_3" for="lesteText" />
                            <p:inputText id="lesteText" styleClass="grid_8" style="width: 30%" readonly="true"
                                         value="#{managerCriarImovel.visuCoordenada.convE}" />
                            <div class="clear"/>
                            <p:outputLabel value="Azimute " styleClass="grid_3" for="azimuteText" />
                            <p:inputText id="azimuteText" styleClass="grid_8" readonly="true"
                                         value="#{managerCriarImovel.visuCoordenada.azimute}" />
                            <p:outputLabel value="Dis " styleClass="grid_3" for="disText" />
                            <p:inputText id="disText" styleClass="grid_8" style="width: 30%" 
                                         readonly="true"
                                         value="#{managerCriarImovel.visuCoordenada.distancia}" />
                            <p:outputLabel value="Limite " styleClass="grid_3" for="limText" />
                            <p:inputTextarea id="limText"  styleClass="grid_19" readonly="true"
                                             value="#{managerCriarImovel.visuCoordenada.limite}" />
                            <br/>


                            <center>

                                <p:commandButton value="Voltar" process="@this" onclick="dlgVisu.hide()" icon="ui-icon-close" />
                            </center>

                        </f:facet>
                    </p:dialog>   
                </p:panel>
            </h:form>
            <h:form id="dlgDelForm">
                <p:panel id="paneldlg" style="background: none; border: none;" 
                         styleClass="container_24 clearfix ">
                    <p:dialog id="modalDialog" header="Confirmação de remoção" widgetVar="dlgdel" modal="true" 
                              height="80" closable="false" resizable="false" >
                        <h:outputText value="Tem certeza que deseja remover estes dados Geográficos ?" />
                        <div class="buttonAction">
                            <p:commandButton value="Sim"
                                             actionListener="#{managerCriarImovel.remover()}"
                                             update="@form"
                                             icon="ui-icon-check"/>
                            <p:commandButton value="Não" icon="ui-icon-close"
                                             oncomplete="dlgdel.hide()" />
                        </div>
                    </p:dialog>

                </p:panel>
            </h:form> 
        </ui:define>
    </ui:composition>

</html>
